from bs4 import BeautifulSoup
if __name__ == '__main__':
    fp2=open('./zhi2.html','r',encoding='utf-8')
    soup2=BeautifulSoup(fp2,'lxml')

    fp = open('./zhi.html', 'r', encoding='utf-8')
    soup = BeautifulSoup(fp, 'lxml')

    x = len(soup.find_all('a', class_='fz14'))
    lie=[]
    for i in range(x):
        zifu=soup2.find_all('td', class_='name')[i].text.strip()+","+soup2.find_all('td', class_='author')[i].text.strip()+","+soup2.find_all('td', class_='download')[i].text.strip()+","+soup2.find_all('td', class_='source')[i].text.strip()+","+soup2.find_all('td', class_='date')[i].text.strip()+",\""+soup.find_all('p', class_='abstract')[i].text.replace("摘要：", " ").strip()+"\""
        lie.append(zifu)
    with open('./Big.csv', 'w+') as f:
        f.write("title,author,download,source,time,contend")
        f.write('\n')
        for i in range(x):
            f.write(lie[i])
            f.write('\n')


